import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter)
// 重写push方法
const lastPush=VueRouter.prototype.push
VueRouter.prototype.push=function(
    loaction,
    onComplete=()=>{},
    onAbort=()=>{}
){
    return lastPush.call(this,loaction,onComplete,onAbort)
}

export default new VueRouter({
    mode:'history',
    routes:[
        {path:'/home',component:()=>import('@/pages/Home'),name:'home'},
        {path:'/login',component:()=>import('@/pages/Login'),name:'login',meta:{isFooterHide:true}},
        {path:'/register',component:()=>import('@/pages/Register'),name:'register',meta:{isFooterHide:true}},
        {path:'/detail/:skuId',component:()=>import('@/pages/Detail'),name:'detail'},
        {path:'/search/:keyword?',component:()=>import('@/pages/Search'),name:'search'},
        {path:'/',redirect:'/home'}
    ]
})